package com.ymttest.database.mongo;

import com.ymt.database.MongoDBDriver;
import com.ymttest.utils.MapUtil;

import java.util.ArrayList;
import java.util.Map;

public class ActivityConfigWapper {

    MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_YmtEvtDatadriver("Ymt_ActivityConfig");

    public boolean update(String groupName,Map<String, Object> updateMap) throws Exception{
        return  mdd.update(MapUtil.hashMap("GroupName",groupName), updateMap).isUpdateOfExisting();
    }

    public Map<String,Object> getActivityConfig(String GroupName) throws Exception {
        ArrayList<Map> list = mdd.selectPartLimitToMap("{\"GroupName\":\"" + GroupName + "\"}",1);

        return list.size()>0?list.get(0):null;
    }


    public static void main(String[] args) throws Exception {

       System.out.println( new ActivityConfigWapper().getActivityConfig("asdfsadfsad1"));
    }
}
